﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>

<%	dim rs,sql,i,id,PageCount,Page,PageOut,PageIn,PageSize,content,classid,RepCount,gm,viphy,nid,read,imgmun,readtime

	PageSize=500

	id=Request.QueryString("id")
	if id="" then id=0
	if not isnumeric(id) then id=0
	id=clng(id)

    	Page = Request("page")      '当前页数
    	If Page = "" Then Page = 1
   	If Not IsNumeric(Page) Then Page = 1
    	Page = CLng(Page)
    	If Page < 1 Then Page = 1


	if sid<>"Null" then

	Set Rs = Server.CreateObject("Adodb.Recordset")

	Sql = "select vip,id from qingtian_user where sid='"&md5(sid) & md5(strReverse(sid))&"'"
	Rs.Open Sql,conn,1,1

	if not (rs.bof and rs.eof)  then
		viphy=rs("vip")
		nid=rs("id")
	end if
	Rs.close	

	Sql = "select id from qingtian_paym where ext=3 and listid="&id&" and  nid="&nid&""
	Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof)  then
		gm=1
	else
		gm=0
	end if
	Rs.close	

	set rs=nothing
	else
		viphy=0
		gm=0
	end if



	conn.execute("update qingtian_photoli set ReadCount=ReadCount+1 where id="&id&"")


	Set Rs = Server.CreateObject("Adodb.Recordset")

	Sql = "select name,classid,zuozhe,laiyuan,RepCount,ReadCount,downCount,[WriteTime],[readtime],tuijian,vip,zf,viphy,vipgm,imgmun from qingtian_photoli where id="&id
	Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof)  then

	readtime=rs("readtime")
		imgmun=rs("imgmun")


		if viphy=1 then
			if rs("vipgm")=1 then
				if gm=1 then
					read=true
				else
					read=false
				end if

			else
				read=true
			end if
		elseif rs("viphy")=1 then
			read=false
		elseif rs("vip")=1 then
				if gm=1 or rs("zf")=0 then
					read=true
				else
					read=false
				end if
		else
			read=true

		end if

		RepCount=rs("RepCount")
		classid=rs("classid")

select case v
case "0"
we0="<br/>"
Randomize()
book1="<input name='Page' format='*N' size='5' maxlength='5'/><a href='photove.asp?id="&id&"&amp;page=$(Page:n)&amp;sid="&sidd&"'>跳页</a><br/>"
book="<input name=""remark"" type=""text"" maxlength=""128"" emptyok=""true"" value="""" /><anchor title=""发表"">发表<go href='photoshowing.asp?id="&id&"&amp;sid="&sidd&"' method='post'><postfield name=""remark"" value=""$(remark)"" /></go></anchor><br/>"
%>
<card title="<%=qingtian.utf8(rs("name"))%>"><p align="<%=qingtian.px%>">
<%
case "1"
hr="<hr>"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
Randomize()
book1="<form action=""photove.asp?id="&id&"&amp;sid="&sidd&""" method=""post"">"&dao&"<input type=""text"" name=""Page"" value="""" format=""*N"" size=""5"" maxlength=""5""/><input type=""submit"" value=""跳页"" />"&we0&"</form>"
book=""&dao&"<form action=""photoshowing.asp?id="&id&"&amp;sid="&sidd&""" method=""post""><input type=""text"" name=""remark"" value="""" /><input type=""submit"" value=""发表"" /></form>"&we0&"<hr>"
%>
<title><%=qingtian.utf8(rs("name"))%></title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%
End Select		


		%><%


		if sid="Null" then
		%><%=dao%><%=zi%>欢迎你<%=zi0%><a href="login.asp?sid=<%=sidd%>&amp;url=photove.asp?id=<%=id%>@@v=<%=v%>@@fv=<%=fv%>@@sid=<%=sidd%>">注册/登陆</a><%=we0%><%
		else
		qingtian.info
		end if
if page=1 then

		%>
		<%=sou%>标题:<%=qingtian.utf8(rs("name"))%><%=we0%>
		<%=we%>作者:<%=qingtian.utf8(rs("zuozhe"))%>,来源:<%=qingtian.utf8(rs("laiyuan"))%><%=we0%>
<%=sou%>下载:<%=qingtian.utf8(rs("downCount"))%>,阅读:<%=qingtian.utf8(rs("ReadCount"))%><%=we0%>
		<%=sou%>添加时间:<%=qingtian.FormatTime(rs("WriteTime"),0)%><%=we0%>
		<%
end if
if read=true  then
Rs.close

		Sql = "select [id],[name],[ext],[urls],[size] from qingtian_photo_down where listid="&id&" order by [pid] asc"
		Rs.Open Sql,conn,1,1
		if not (rs.bof and rs.eof)  then
		if page>round(rs.RecordCount/2) then page=round(rs.RecordCount/2)
		if page=0 then page=1
		For i=1 to rs.RecordCount
                if i>(page-1)*imgmun and i<=imgmun*page then
		%>
		<%=we%><img src="<%=qingtian.utf8(rs("urls"))%>" alt="."/><%=we0%>
		<%=sou%><a href="photodown.asp?id=<%=rs("id")%>&amp;sid=<%=sidd%>"><%=i%>.下载(<%=rs("ext")%>/<%=rs("size")%>)</a><%=we0%><%=sou%>
		<%
		end if
		Rs.MoveNext
		next

		if rs.RecordCount\imgmun=rs.RecordCount/imgmun then
			pagecount=rs.RecordCount\imgmun
		else
			pagecount=rs.RecordCount\imgmun+1
		end if

    		'分页
    		If Page < pagecount Then
    		    Response.Write("<a href='photove.asp?id="&id&"&amp;page=" & Page + 1 & "&amp;sid="&sidd&"'>下一页</a>")
    		End If
       
    		If Page > 1 And Page < pagecount Then
    		    Response.Write("|")
    		End If
        
    		If Page > 1 Then
    		    Response.Write("<a href='photove.asp?id="&id&"&amp;page=" & Page - 1 & "&amp;sid="&sidd&"'>上一页</a>" & we0 & "")
    		Elseif i >1 then
    		    Response.Write("" & we0 & "")
    		End If
            
    		Randomize()
    
    		If pagecount > 2 Then

    		   %>
		<%=book1%>
		<% 
   		End If
                                                                
 

    		Response.Write("" & we & "(第" & Page & "/总" & PageCount & "页/共"&rs.RecordCount&"张)" & we0 & "")
		End If
else
			if rs("viphy")=1 then
				if viphy=1  then
				%><%=we%>你还没有购买,购买需金币<%=rs("zf")%><%=we0%><%=sou%><a href="paym.asp?ext=3&amp;id=<%=id%>&amp;sid=<%=sidd%>">马上购买</a><%=we0%><%
				else
				%><%=we%>查看图片出错!该图片为VIP会员查看.请确认你为VIP会员!<%=we0%><%
				end if
			else
				if sid<>"Null" then
				%><%=we%>你还没有购买,购买需金币<%=rs("zf")%>!<%=we0%><%=sou%><a href="paym.asp?ext=3&amp;id=<%=id%>&amp;sid=<%=sidd%>">马上购买</a><%=we0%><%
				else
				%><%=we%>查看图片出错!该图片为会员查看.请先登陆再查看!<%=we0%><%
				end if
			end if
		end if
		 %>
			<%=sou%>对该图片点评:<%=we0%>	
		<%=book%>
		<%
		Rs.close

Sql = "select top 3 id,content,user,uid from qingtian_photo_reply where  listid="&id&"  order by id desc"


            
		Rs.Open Sql,conn,1,1
		if not (rs.bof and rs.eof)  then
		For i=1 to rs.RecordCount
dat=RepCount+1-i
dat1=dat mod 2
if dat1=0 then
%>


		<%=we%><%=zi%><%=dat%>楼.<%=zi0%>[<%=qingtian.utf8(rs("user"))%>]说:<%=qingtian.ubb(rs("content"))%><%=we0%>
<%
else
%>
<%=sou%><%=zi%><%=dat%>楼.<%=zi0%>[<%=qingtian.utf8(rs("user"))%>]说:<%=qingtian.ubb(rs("content"))%><%=we0%>




<%
                End If
		Rs.MoveNext
		next
		end if
	
		%>
			<%=we%><a href="photoshowinglist.asp?infoid=<%=id%>&amp;sid=<%=sidd%>">更多评论(<%=RepCount%>条)</a><%=we0%>
		<%
	else


select case v
case "0"
we0="<br/>"
%>
<card title="出错啦"><p align="<%=qingtian.px%>">
<%
case "1"
hr="<hr>"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>出错啦</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%
End Select
%><%
		classid=0
 	end if
	Rs.close
	

 If DateDiff("m", readtime, Now()) > 0 Then
                conn.execute("update qingtian_photoli set [Monthread]=1,[readtime]='" & Now() & "' where [id]=" & id & "")
            Else
                conn.execute("update qingtian_photoli set [Monthread]=[Monthread]+1,[readtime]='" & Now() & "' where [id]=" & id & "")
            End If

            If DateDiff("ww", readtime, Now()) > 0 Then
                conn.execute("update qingtian_photoli set [Weekread]=1 where [id]=" & id & "")
            Else
                conn.execute("update qingtian_photoli set [Weekread]=[Weekread]+1 where [id]=" & id & "")
            End If

            If DateDiff("d", readtime, Now()) > 0 Then
                conn.execute("update qingtian_photoli set [Dayread]=1 where [id]=" & id & "")
            Else
                conn.execute("update qingtian_photoli set [Dayread]=[Dayread]+1 where [id]=" & id & "")
            End If



	Sql = "select top 1 id,name from qingtian_photoli where  classid="&classid&" and id<"&id&"  order by id desc"


	Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof)  then
			%><%=sou%>&gt;&gt;<a href="photove.asp?id=<%=rs(0)%>&amp;sid=<%=sidd%>"><%=qingtian.utf8(rs(1))%></a><%=we0%><%
	end if
	Rs.close	



	Sql = "select top 1 id,name from qingtian_photoli where  classid="&classid&" and id>"&id&"  order by id asc"


	Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof)  then
			%><%=sou%>&lt;&lt;<a href="photove.asp?id=<%=rs(0)%>&amp;sid=<%=sidd%>"><%=qingtian.utf8(rs(1))%></a><%=we0%><%
	end if
	Rs.close	

Sql = "select top 1 [name] from qingtian_class where id="&classid&""

	Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof)  then
		%><%=we%><a href="photoli.asp?listid=<%=classid%>&amp;sid=<%=sidd%>">返回<%=qingtian.utf8(rs("name"))%></a><%=we0%><%
	end if
	Rs.close

	set rs=nothing

   		    Response.Write(""&dao&"<a href='index.asp?sid="&sidd&"'>网站首页</a><br/>")

end Function
%>
